package com.service.infocenter.imp;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.mapper.infocenter.UserRegisterMapper;
import com.po.UserRegisterInfo;
import com.service.infocenter.UserRegisterService;
import com.util.MD5Util;

@Service
public class UserRegisterServiceImp implements UserRegisterService {
	@Resource(name = "userRegisterMapper")
	private UserRegisterMapper userRegisterMapper;

	@Override
	public int addUserRegister(UserRegisterInfo userRegister) {
		int i = userRegisterMapper.addUserRegister(userRegister);
		return i;
	}

	@Override
	public int deleteUserRegister(String userid) {
		int i = userRegisterMapper.deleteUserRegister(userid);
		return i;
	}

	@Override
	public int deleteUserRegisterList(String[] userid) {
		int i = userRegisterMapper.deleteUserRegisterList(userid);
		return i;
	}

	@Override
	public int updateUserRegister(UserRegisterInfo userRegister) {
		int i = userRegisterMapper.updateUserRegister(userRegister);
		return i;
	}

	@Override
	public boolean addUserRegisterIsOk(UserRegisterInfo userRegister) {
		UserRegisterInfo userRegisterr = userRegisterMapper.getUserRegisterListByID(userRegister);
		if (userRegisterr == null) {
			return true;
		}
		else{
			return false;
		}			
	}

	@Override
	public UserRegisterInfo getUserRegisterListByID(UserRegisterInfo userRegister) {
		UserRegisterInfo info = userRegisterMapper.getUserRegisterListByID(userRegister);
		return info;
	}

	@Override
	public int updatepwd(UserRegisterInfo userRegister) {
		userRegister.setUser_password(MD5Util.getMD5(userRegister.getUser_password()));
		int i=userRegisterMapper.updatepwd(userRegister);
		return i;
	}

}
